The present invention relates to a simulating method and apparatus for grasping the operating status of an electric network in advance in designing the electric network, and a computer-readable storage medium for storing a simulation program.
As a conventional method of solving an electric network, for example, as shown in FIG. 15, to obtain voltages at nodes node1 to node3 connected to the respective elements in a circuit having resistive elements R1 and R2 connected in series with a current source I1, the current and voltage formulas of this circuit are represented by matrix (1) as follows:
                              [                                                                      I                  1                                                                                    0                                                                                      -                                      I                    1                                                                                ]                =                              [                                                                                G                    1                                                                                        -                                          G                      1                                                                                        0                                                                                                  -                                          G                      1                                                                                                                                  G                      1                                        +                                          G                      2                                                                                                            -                                          G                      2                                                                                                                    0                                                                      -                                          G                      2                                                                                                            G                    2                                                                        ]                    ⁡                      [                                                                                V                    1                                                                                                                    V                    2                                                                                                                    V                    3                                                                        ]                                              (        1        )            where G is the conductance as the reciprocal of a resistance R.
When the above matrix is simply expressed as I=GV, it can be replaced with a mathematical problem for calculating a V matrix by giving I and G matrices. In the above matrix (1), G is LU-decomposed to rewrite matrix (1) into I=LUV. The LU matrix is comprised of lower and upper triangular matrices having elements represented by matrix (2):
                              [                                                                      G                  11                                                                              G                  12                                                                              G                  13                                                                                                      G                  21                                                                              G                  22                                                                              G                  23                                                                                                      G                  31                                                                              G                  32                                                                              G                  33                                                              ]                =                              [                                                                                L                    11                                                                    0                                                  0                                                                                                  L                    21                                                                                        L                    22                                                                    0                                                                                                  L                    31                                                                                        L                    32                                                                                        L                    33                                                                        ]                    ⁡                      [                                                            1                                                                      U                    12                                                                                        U                    13                                                                                                0                                                  1                                                                      U                    23                                                                                                0                                                  0                                                  1                                                      ]                                              (        2        )            
If a Z matrix satisfying I=LZ is present, LZ=LUV holds. Z=UV is obtained by eliminating L from the right- and left-hand sides. If Z is known, V can be obtained.
The general term of the L and U matrices can be expressed by equation (3), and the Z matrix can be expressed by equation (4). The V matrix as the final solution can be expressed by equation (5). A correct solution can be obtained by sequentially solving these equations.
                    [                                                                              [                                                            L                      im                                        =                                                                  G                        im                                            -                                                                        ∑                                                      j                            =                            1                                                                                m                            -                            1                                                                          ⁢                                                                                                  ⁢                                                                              L                            ij                                                    ⁢                                                                                                          ⁢                                                      U                            jm                                                                                                                                ]                                                                      i                    =                    m                                    ,                                                                          ⁢                  …                  ⁢                                                                          ,                  n                                                                                                                          [                                                            U                      mj                                        =                                                                  (                                                                              G                            mj                                                    -                                                                                    ∑                                                              k                                =                                1                                                                                            m                                -                                1                                                                                      ⁢                                                                                                                  ⁢                                                                                          L                                mk                                                            ⁢                                                                                                                          ⁢                                                              U                                kj                                                                                                                                    )                                            /                                              L                                                  m                          ⁢                                                                                                          ⁢                          m                                                                                                      ]                                                                      j                    =                                          m                      +                      1                                                        ,                                      m                    +                    2                                    ,                                                                          ⁢                  …                  ⁢                                                                          ,                  n                                                                    ]                            (        3        )                                          [                                    Z              i                        =                                          (                                                      I                    1                                    -                                                            ∑                                              k                        =                        1                                                                    i                        -                        1                                                              ⁢                                                                                  ⁢                                                                  L                                                  1                          ⁢                          k                                                                    ⁢                                                                                          ⁢                                              Z                        k                                                                                            )                            /                              L                ii                                              ]                                      i            =            1                    ,          2          ,                                          ⁢          …          ⁢                                          ,          n                                    (        4        )                                          [                                    V                              n                -                i                                      =                                          Z                                  n                  -                  i                                            -                                                ∑                                      k                    =                                          n                      -                      i                      +                      1                                                        n                                ⁢                                                                  ⁢                                                      U                                                                  n                        -                        i                                            ,                      k                                                        ⁢                                                                          ⁢                                      V                    k                                                                                ]                                      i            =            0                    ,          1          ,          2          ,                                          ⁢          …          ⁢                                          ,                      n            -            1                                              (        5        )            
FIG. 16 is a flow chart of the prior art. Basically, the above contents are formed into an algorithm. It should be noted that the U matrix is calculated by a division using the diagonal elements of the matrix L. The diagonal elements of the matrix L are L11, L22, L33, . . . . Values (including zero) set in these diagonal elements are determined depending on the G matrix that describes the circuit.
If the circuit is comprised of only resistive elements, and the resistances do not change, the value of the G matrix is also fixed. It is, therefore, possible to make the diagonal elements of the matrix L non-zero. If the diagonal elements become zero, the condition branches to change the order of the elements of the G matrix in FIG. 16.
Assume that a resistive element has a variable R value. When the impedance value of this resistive element changes depending on the status of the circuit, that the diagonal elements of the L matrix are made non-zero is not guaranteed beforehand. In an actual algorithm, that the diagonal elements are made non-zero must always be monitored.
If a value except non-zero but infinitely close to zero is set in the diagonal element, a division error occurs in a numerical calculation expressed by a finite number of bits, and a large calculation error may occur in the subsequent calculation results. In particular, when the differential term of the terminal voltage or current of an element is given as a denominator, for example, when a calculation item in which a value obtained by subtracting a voltage at time immediately preceding given time from a voltage at the given time becomes a denominator, a voltage applied across the element is not known beforehand, but known after a simulation. The value of this denominator is unknown. When a differential coefficient is zero, i.e., when the voltage value at the time immediately preceding the given time and the voltage value at the given time are zero or almost zero, the calculation result becomes very poor due to numerical errors. The subsequent calculations are meaningless in practice. An algorithm for always monitoring the number of effective digits even for non-zero values is required.
The above problems are inevitably posed when a solution is obtained by solving a matrix. Even if the concept of the basic solution is simple, an algorithm for solving the above problems is required, resulting in redundant computation as a whole.